<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <include file="Pub:head"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/Style.css" />
    <script type="text/javascript">
        function updateyewu(type,yewuname,status,cid,company)
        {
            if(status =='0')
            {
                if(confirm("确定要给"+company+"开通"+ yewuname +"业务吗？"))
                {
                    top.Dialog.open({URL:"__URL__/addyewu/cid/"+cid+"/type/"+type,Title:"开通"+ yewuname +"业务",Width:600,Height:600});
                }
            }
            else
            {
                if(confirm("确定要关闭"+company+"的"+ yewuname +"业务吗？"))
                {
                    var url="__URL__/closeyewu/cid/"+cid+"/type/"+type;
                    window.location.assign(url);
                }
            }

        }

        function editcustom(id){
            top.Dialog.open({URL:"__APP__/kefu/addcustom/id/"+id,Title:"编辑客户",Width:600,Height:400});
        }
        function giveupcustom(id){
            if(confirm("确定要放弃该客户吗？"))
            {
                var url="__URL__/customgiveup/id/"+id;
                window.location.assign(url);
            }
        }

        function deletecustom(id)
        {
            if(confirm("确定要删除该客户吗？"))
            {
                var url="__URL__/customdelete/id/"+id;
                window.location.assign(url);
            }
        }

        function showcustom(id)
        {
            top.Dialog.open({URL:"__APP__/kefu/showcustom/id/"+id,Title:"查看客户",Width:600,Height:400});
        }

        function search()
        {
            query_userName= $("#query_userName").val()==""?"0":$("#query_userName").val();
            var url="__URL__/index/query_type/"+$("#type").val()+"/query_userName/"+query_userName+"/query_isgiveup/"+$("#query_isgiveup").val();
            window.location.assign(url);
        }
    </script>


</head>
<body>
<div class="box1">

    <fieldset style="border-color:#999999;">
        <legend>客户管理</legend>
        <div class="box2" panelTitle="功能面板" id="searchPanel">
            <table>
                <tr>
                    <td>
                        <button type="button" onclick='top.Dialog.open({URL:"__APP__/kefu/addcustom/",Title:"添加新客户 ",Width:600,Height:380});'><span class="icon_add">新增客户</span></button>
                    </td>
                    <td style=" width:20px;"></td>
                    <td>客户名称：</td>
                    <td><input id="query_userName" name="query_userName" value="{$query_userName}" type="text"/></td>
                    <td>业务类型：</td>
                    <td>
                        <select name="type" id="type" keepDefaultStyle="true">
                            <option value="0" <?php if($query_type=='0') echo "selected";?>>全部</option>
                            <option value="1"  <?php if($query_type=='1') echo "selected";?>>400</option>
                            <option value="2"  <?php if($query_type=='2') echo "selected";?>>网站客户</option>
                            <option value="3"  <?php if($query_type=='3') echo "selected";?>>优化客户</option>
                            <option value="4"  <?php if($query_type=='4') echo "selected";?>>易商通客户</option>
                        </select>
                    </td>
                    <td>客户状态：</td>
                    <td>
                        <select name="query_isgiveup" id="query_isgiveup" keepDefaultStyle="true">
                            <option value="0" <?php if($query_isgiveup=='0') echo "selected";?>>正常</option>
                            <option value="1" <?php if($query_isgiveup=='1') echo "selected";?>>已放弃</option>
                        </select>
                    </td>

                    <td>
                        <button type="button" onclick="search()"><span class="icon_find">查询</span></button>
                    </td>


                </tr>
            </table>
        </div>

        <table class="tableStyle">
            <tr id="{$vo['id']}">
                <td>负责人</td>
                <td>公司名称</td>
                <td>联系电话</td>
                <td>400客户</td>
                <td>网站客户</td>
                <td>优化客户</td>
                <td>易商通客户</td>
                <td>操作</td>
            </tr>
            <volist name="custom_list" id="vo">
                <tr>
                    <td>{$vo['cname']}</td>
                    <td><span <?php if(mb_strlen($vo['company'],'utf8')>15){ ?> title="{$vo['company']}<?php } ?>">
                        {$vo['company']|msubstr=0,15,'utf-8',false}</span></td>
                    <td>{$vo['tel']}</td>
                    <td style=" text-align:center;">
                        <?php
                     if($query_isgiveup=='0')
                     {
                      if(empty($vo['400tel'])) $tel='0'; else $tel='1';
                     ?>
                                <a onclick="updateyewu('1','400电话',{$tel},{$vo['id']},\'{$vo['company']}\');">
                        <?php }
                        if(empty($vo['400tel'])) echo '×'; else echo'√';
                        if($query_isgiveup=='0'){ ?>
                                  </a>
                        <?php }?>
                    </td>
                    <td style=" text-align:center;">
                        <?php
                     if($query_isgiveup=='0')
                     {
                     if(empty($vo['website'])) $website='0'; else $website='1';
                     ?>
                        <a onclick="updateyewu('2','网站',{$website},{$vo['id']},\'{$vo['company']}\');">
                        <?php }
                            if(empty($vo['website'])) echo '×'; else echo'√';
                            if($query_isgiveup=='0'){ ?>
                        </a>
                        <?php }?>
                    </td>
                    <td style=" text-align:center;">
                        <?php
                     if($query_isgiveup=='0')
                     {
                     if(empty($vo['youhua'])) $youhua='0'; else $youhua='1';
                     ?>
                        <a onclick="updateyewu('3','优化',{$youhua},{$vo['id']},\'{$vo['company']}\');">
                        <?php }
                          if(empty($vo['youhua'])) echo '×'; else echo'√';
                          if($query_isgiveup=='0'){?>
                        </a>
                        <?php }?>
                    </td>
                    <td style=" text-align:center;">
                        <?php
                     if($query_isgiveup=='0')
                     {
                     if(empty($vo['yishangtong'])) $yishangtong='0'; else $yishangtong='1';
                     ?>
                        <a onclick="updateyewu('4','易商通',{$yishangtong},{$vo['id']},\'{$vo['company']}\');">
                        <?php }
                           if(empty($vo['yishangtong'])) echo '×'; else echo'√';
                           if($query_isgiveup=='0'){?>
                        </a>
                        <?php }?>
                    </td>
                    <td>
                        <?php
                     if($query_isgiveup=='0')
                     { ?>
                        <a  href="javascript:void(0);"  onclick="editcustom({$vo['id']});"> 编辑 </a> /
                        <a  href="javascript:void(0);"  onclick="giveupcustom({$vo['id']});"  href="__URL__/customgiveup/id/{$vo['id']}">放弃</a>/
                        <?php
                     }?>
                        <a  href="javascript:void(0);"  onclick="showcustom({$vo['id']});">查看</a>/
                        <a  href="javascript:void(0);"  onclick="deletecustom({$vo['id']});"  href="__URL__/customdelete/id/{$vo['id']}">删除</a>
                    </td>
                </tr>
            </volist>
        </table>

    </fieldset>


</div>

<div id="TourExPage" class="page">{$pageshow}</div>
</body>
</html>